<!--{include(pe_tpl('header.html'));}-->
<div class="right_page">
	<div class="now">
		<a href="javascript:;" class="sel">{$menutitle}<i></i></a>
		<div class="clear"></div>
	</div>
	<form method="post" id="form" autocomplete="off">
	<div class="right_main">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat20 mab20">
		<!--<tr>
			<td align="right">商品类型：</td>
			<td>{$ini['product_type'][$info['product_type']]}<input type="hidden" name="info[product_type]" value="{$info['product_type']}" /></td>
		</tr>-->
		<tr>
			<td align="right" width="200">商品名称：</td>
			<td><input type="text" name="info[product_name]" value="{$info['product_name']}" class="inputall input700" /></td>
		</tr>
		<tr>
			<td align="right">商品分类：</td>
			<td>
				<select name="info[category_id]" class="inputselect" style="width:250px">
				<option value="0">-- 主分类 --</option>
				<!--{foreach($category_treelist as $v):}-->
				<option value="{$v['category_id']}" <!--{if($v['category_id']==$info['category_id']):}-->selected="selected"<!--{endif;}-->>{$v['category_showname']}</option>
				<!--{endforeach;}-->
				</select>
				<select name="info[category_id2]" class="inputselect" style="width:250px">
				<option value="0">-- 附加分类 --</option>
				<!--{foreach($category_treelist as $v):}-->
				<option value="{$v['category_id']}" <!--{if($v['category_id']==$info['category_id2']):}-->selected="selected"<!--{endif;}-->>{$v['category_showname']}</option>
				<!--{endforeach;}-->
				</select>
			</td>
		</tr>
		<tr>
			<td align="right">品牌名称：</td>
			<td>
				<select name="info[brand_id]" class="inputselect" style="width:250px">
				<option value="0">-- 请选择 --</option>
				<!--{foreach($cache_brand as $v):}-->
				<option value="{$v['brand_id']}" <!--{if($v['brand_id']==$info['brand_id']):}-->selected="selected"<!--{endif;}-->>[{$v['brand_word']}] {$v['brand_name']}</option>
				<!--{endforeach;}-->
				</select>
			</td>
		</tr>
		<tr>
			<td align="right">商品图片：</td>
			<td id="album_box">
				<!--{foreach(array(0,1,2,3,4) as $k=>$v):}-->
				<div class="upload_box fl mar10" style="width:100px;height:100px">
					<img src="{pe_thumb($album_list[$k], 100, 100)}" class="upload_img" />
					<input type="hidden" name="product_album[]" value="{$album_list[$k]}" class="upload_val">
				</div>
				<!--{endforeach;}-->
			</td>
		</tr>
		<tr>
			<td align="right">卡密商品：</td>
			<td class="layui-form">
				<input type="checkbox" name="product_virtual" value="1" <!--{if($info['product_virtual']):}-->checked<!--{endif;}--> <!--{if($act=='edit'):}-->readonly<!--{endif;}--> lay-skin="switch" lay-text="是|否" />
			</td>
		</tr>
		</table>
	</div>
	<div class="right_main divhide">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat10 mab10">
		<tr>
			<td align="right" width="200">会员折扣：</td>
			<td>
				<table width="100%" class="list" style="width:650px;">
				<tr>
					<!--{foreach($cache_userlevel as $v):}-->
					<th class="bgtt" width="{intval(100/count($cache_userlevel))}%">{$v['userlevel_name']}（{$v['userlevel_zhe']*100}%）</th>
					<!--{endforeach;}-->
				</tr>
				<tr>
					<!--{foreach($cache_userlevel as $v):}-->
					<td><input type="text" name="product_zhekou[{$v['userlevel_id']}]" value="{$product_zhekou[$v['userlevel_id']]*100}" class="inputall input50" /> %</td>
					<!--{endforeach;}-->
				</tr>
				</table>
			</td>
		</tr>
		</table>
	</div>
	<div class="right_main">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat10 mab10">
		<tr>
			<td align="right" width="200">商品规格：</td>
			<td>
				<!--<a href="javascript:;" class="admin_btn mar10" onclick="rule_open()">添加规格</a>
				<a href="javascript:;" class="admin_btn" onclick="rule_close()">关闭规格</a>-->
				<a href="javascript:;" class="admin_btn mar10" onclick="rule_add()">添加规格</a>
				<div id="product_rule">
				<script type="text/html" id="product_rule_tpl">	
				{{each data as v k}}
				<div class="gg_box" style="width:850px">
					<div class="gg_tt">
						<div class="fl"><input type="text" value="{{v.name}}" class="inputtext" onblur="rule_edit(this, {{k}})" placeholder="请填写规格名称" /></div>
						<!--<div class="fl tjimg"><input type="checkbox" class="mar5">添加图片</div>-->
						<div class="fr cblue" onclick="rule_del(this, {{k}})">删除规格</div>
						<div class="clear"></div>			
					</div>
					<div class="gg_list">
						{{each v.list as vv kk}}
						<div class="fl gg_data"><input type="text" value="{{vv.name}}" class="inputtext" onblur="ruledata_edit(this, {{k}}, {{kk}})" ></div>
						{{/each}}
						<div class="fl gg_data"><input type="text" value="" class="inputtext" onblur="ruledata_add(this, {{k}})" placeholder="请填写规格选项值"></div>
						<div class="clear"></div>
					</div>
				</div>
				{{/each}}
				</script>
				</div>
			</td>
		</tr>
		<tr>
			<td align="right">价格库存：</td>
			<td id="prodata_list">
				<script type="text/html" id="prodata_list_tpl">
				<table class="list_border" style="width:850px">
				<tr>
					{{each rule as v k}}
					{{if v.name != '' && v.list.length > 0}}
					<th class="bgtt">{{v.name}}
						<input type='hidden' name='product_rule[{{k}}][name]' value='{{v.name}}' />
						{{each v.list as vv kk}}
						<input type='hidden' name='product_rule[{{k}}][list][{{kk}}][name]' value='{{vv.name}}' />
						<input type='hidden' name='product_rule[{{k}}][list][{{kk}}][logo]' value='{{vv.logo}}' />
						{{/each}}
					</th>
					{{/if}}
					{{/each}}
					<th class="bgtt cred">价格<a href="javascript:money_edit_all('product_money', '价格');" class="cblue mal5">[批]</a></th>
					<th class="bgtt">原价<a href="javascript:money_edit_all('product_ymoney', '原价');" class="cblue mal5">[批]</a></th>
					<th class="bgtt">编码<a href="javascript:money_edit_all('product_sn', '编码');" class="cblue mal5">[批]</a></th>
					<th class="bgtt">库存<a href="javascript:money_edit_all('product_num', '库存');" class="cblue mal5">[批]</a></th>
				</tr>
				{{each list as v k}}
				<tr>
					{{each v.rule_arr as vv kk}}
					{{if v.colspan[kk] > 0}}<td rowspan="{{v.colspan[kk]}}">{{vv}}</td>{{/if}}
					{{/each}}
					<td style="padding:0"><input type="text" name="product_money[]" value="{{v.product_money}}" class="inputtext" onblur="money_edit(this, '{{v.product_ruleid}}', 'product_money')" /></td>
					<td style="padding:0"><input type="text" name="product_ymoney[]" value="{{v.product_ymoney}}" class="inputtext" onblur="money_edit(this, '{{v.product_ruleid}}', 'product_ymoney')" /></td>
					<td style="padding:0"><input type="text" name="product_sn[]" value="{{v.product_sn}}" class="inputtext" onblur="money_edit(this, '{{v.product_code}}', 'product_code')" /></td>
					<td style="padding:0"><input type="text" name="product_num[]" value="{{v.product_num}}" class="inputtext" onblur="money_edit(this, '{{v.product_ruleid}}', 'product_num')" /></td>
					<td class="divhide">
						<input type="hidden" name="product_ruleid[]" value="{{v.product_ruleid}}" />
						<input type="hidden" name="product_rulename[]" value="{{v.product_rulename}}" />						
					</td>
				</tr>
				{{/each}}
				</table>
				</script>
			</td>
		</tr>
		<tr>
			<td align="right">运费设置：</td>
			<td>
				<select name="info[wlmb_id]" class="inputselect" style="width:250px">
				<option value="0">-- 请选择运费模板 --</option>
				<!--{foreach($wlmb_list as $v):}-->
				<option value="{$v['wlmb_id']}" <!--{if($v['wlmb_id']==$info['wlmb_id']):}-->selected="selected"<!--{endif;}-->>{$v['wlmb_name']}</option>
				<!--{endforeach;}-->
				</select>
				<a href="admin.php?mod=wlmb" target="_blank" class="cblue mal10">管理模板</a>
			</td>
		</tr>
		</table>
	</div>
	<div class="right_main">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat10 mab10">
		<tr>
			<td align="right" width="200">商品详情：</td>
			<td style="padding:5px">
				<textarea name="info[product_text]" id="editortext" style="width:850px;height:500px">{$info['product_text']}</textarea>		
			</td>
		</tr>
		</table>
	</div>
	<div class="right_bottom center">
		<input type="hidden" name="pe_token" value="{$pe_token}" />
		<input type="hidden" name="pesubmit" value="{$pe_token}" />
		<input type="button" value="提 交" class="tjbtn">
	</div>
	</form>
</div>
<link rel="stylesheet" href="{$pe['host']}include/plugin/layui/css/layui.css">
<script src="{$pe['host']}include/plugin/layui/layui.js"></script>
<script charset="utf-8" src="{$pe['host']}include/plugin/my97/WdatePicker.js"></script>
<script type="text/javascript" src="{$pe['host']}include/plugin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="{$pe['host']}include/plugin/ueditor/ueditor.api.js"></script>
<link rel="stylesheet" href="{$pe['host']}include/plugin/plupload/{$cache_setting['upload_server']}/style.css">
<script src="{$pe['host']}include/plugin/plupload/{$cache_setting['upload_server']}/plupload.min.js"></script>
<script src="{$pe['host']}include/plugin/plupload/{$cache_setting['upload_server']}/upload.js"></script>
<script src="{$pe['host']}include/js/product.js"></script>
<script type="text/javascript">
//prodata_list("{$info['product_id']}", 'list');
var product_rule = {json_encode($product_rule)};
var prodata_list = {json_encode($prodata_list)};
product_rule_refresh();
prodata_list_refresh();
$(function(){
	$("#album_box").pe_upload();
	$(":button").click(function(){
		var kong_num = rule_num = 0;
		$("#rule_html").find(":input").each(function(){
			if ($(this).attr("disabled") == "disabled" || $(this).is(":hidden")) return true;
			if ($(this).val() == '') kong_num++;
		})
		if (kong_num > 0) {
			alert('规格属性尚未填写完全');
			return;
		}
		pe_submit("{pe_nowurl()}", function(json){
			if (json.code == 1) pe_open('back', 1000);
		})
	})
});
layui.use(['form'], function(){
	form = layui.form;
});
UE.getEditor('editortext');
</script>
<style>
.list_border{table-layout:fixed;}
.list_border input{width:100% !important; height:40px !important;border:1px solid #fff !important; border-radius:0; box-sizing: border-box; text-align: center; display: block}
.list_border input:hover{border:1px #409eff solid !important}
</style>
<!--{include(pe_tpl('footer.html'));}-->